package com.k2data.k2app;

/**
 * Created by clb on 17-7-17.
 */

import com.k2data.k2app.util.schedule.ScheduleJobService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import org.springframework.stereotype.Component;

/**
 * 服务启动执行
 */
@Component
public class MyStartupRunner1 implements CommandLineRunner {
    @Autowired
    SchedulerFactoryBean schedulerFactoryBean;
    @Autowired
    ScheduleJobService scheduleJobService;
    @Override
    public void run(String... args) throws Exception {
        System.out.println(">>>>>>>>>>>>>>>服务启动执行，执行加载数据,任务启动等操作<<<<<<<<<<<<<");
        init();
    }

    /**
     * 在项目启动时运行以下代码
     * @throws Exception
     */
    public void init() throws Exception {
        scheduleJobService.getAllSchedules();
    }
}
